#include "Bitree_Fun.h"

int main(){
	int number;
	Bitree T; //创建二叉树T
    T=(node*)malloc(sizeof(node));
	T=NULL;
    queue front;//创建队列
    queue rear;
    front=(pnode*)malloc(sizeof(pnode));
    rear=(pnode*)malloc(sizeof(pnode));
    front->next=rear;
	int sign=1;
	menu();
	while(sign!=0){
		printf("please input:"); 
		scanf("%d",&sign);
		switch(sign){
			case 1://添加数据到二叉树                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
		    	printf("please input count of all data:");
	            int i,t;
             	scanf("%d",&t);
	            printf("please input data\n");
	            for(i=0;i<t;i++){
	            scanf("%d",&number);
	            create_Bitree(T,number);
	            }	        
			break;	
			case 2://遍历二叉树
			printf("1:front_traversal,2:mid_traversal,3:rear_traversal,4:sequence_traversal\n please input:");
			scanf("%d",&number);
			switch(number)
			{
				case 1://前序遍历
				front_traversal(T);
				break;
				case 2://中序遍历
				mid_traversal(T);	
				break;
				case 3://后序遍历
				rear_traversal(T);	
				break;
				case 4://层序遍历
			    sequence_traversal(T,front,rear);
				break;
			}
			break;
			case 3://按值查找
			printf("please input data of you want to find:");
			scanf("%d",&number);
			find_Bitree(T, number);
			break;
			case 4://按值删除
			printf("please input data of you want to delete:");
			scanf("%d",&number);
		    delete_find_Bitree(T,number);
		    break;
		}
		
		
	}


	return 0;
}


